﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TDNA
{
    public class Cannon:IWeapon
    {
        private int Freq,Dmg;
        private int LastShot = 0;
        public BasicCreep Target { get; internal set; }

        public Cannon(int f, int d)
        {
            Freq = f;
            Dmg = d;
        }

        public void Fire()
        {
            if (Target == null) return;
            if (LastShot > 0) return;

            LastShot = Freq;
            if (Target is BasicCreep) (Target as BasicCreep).HP -= Dmg;
        }

        public void Update(ulong gameTime)
        {
            if (LastShot > 0) LastShot -= (int) gameTime;
        }
    }
}
